package org.example.web;

import org.example.model.Contact;
import org.example.model.Result;
import org.example.service.ContactService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController //功能是将类声明为一个控制器，并使其中的方法可以直接响应HTTP请求
@RequestMapping("/userApi/contact")
public class ContactController {
    @Autowired
    private ContactService contactService;

//    接收反馈表单
    @RequestMapping("/text")
    public Result text(@RequestBody Contact contact) {
        contactService.text(contact);
        return new Result(200, "反馈成功！", null);
    }
        ;
}
